<?php
/**
 * Created by PhpStorm.
 * User: xiaoxin
 * Date: 2018/10/20 0020
 * Time: 10:04
 */
namespace app\index\validate;
use think\Validate;

class AddUserCheck extends Validate
{
	protected $rule =   [
		'accepted'=>'accepted',
		'captcha'=>'require|captcha',
		'username'=>'require|regex:[a-z 0-9 A-Z]\w{6,20}|unique:user',
		'password'=>'require|length:8,25',
		'repassword'=>'require|confirm:password',
		'phone'=>'require|regex:1\d{10}|unique:user',
	];
	protected $message  =   [
		'accept'=>'请同意服务',
		'captcha.require'=>'请填写验证码',
		'captcha'=>'验证码错误',
		'username.require'=>'请填写您的用户名',
		'username'=>'用户名只能在6-20位',
		'username.unique'=>'用户名已存在',
		'password'=>'请填写密码',
		'password.require'=>'密码只能在8-25位',
		'repassword.confirm'=>'两次密码不一致',
		'repassword'=>'请确认密码',
		'phone'=>'请填写您手机',
		'phone.regex'=>'手机格式错误',
		'phone.unique'=>'该手机已存在',
	];
	protected $scene = [
		'phone'  =>  ['phone','captcha'],
	];
}